← Back
Editing: index297.js
import{s as e,j as l,r as a,k as d,g as s,b5 as o,c as t,p as i,a5 as n,q as u,v as r,e as m,A as c,x as _,F as p,a$ as f,M as w,y as b,z as h,J as V,H as v,I as g,P as x,aj as F,ak as P,S as N,aa as I,b9 as U,ba as j,a8 as y,bY as B,b0 as D,R as z}from"./base-lib.js?v=1765440387";import{K as k,N as S,fi as q,M as C,j as K,e as M}from"./utils-lib.js?v=1765440387";import{u as T,J as E,K as H}from"./useStore7.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./validator.js?v=1765440387";import"./index94.js?v=1765440387";import"./column.js?v=1765440387";const A=l("FTP-ACCESS-STORE",()=>{const e=a(!1),l=a(0),o=a(0),t=a(),i=a(!1),n=a({username:"",download_bandwidth:"",upload_bandwidth:"",max_files:"",max_size:"",ratio:"",allowed_local_ips:"",denied_local_ips:"",allowed_client_ips:"",denied_client_ips:"",time_restrictions:[],max_sim_sessions:""}),u=d({download_bandwidth:"KB",upload_bandwidth:"KB",max_size:"KB"}),r=a(["KB","MB","GB"]),m=a({});return{accessFormFef:t,accessForm:n,uNum:l,dNum:o,icon:s(()=>e.value?"svgtofont-el-arrow-up":"svgtofont-el-arrow-down"),unitForm:u,advancedConfiguration:e,unitData:r,skipNull:i,AccessData:m}}),O=()=>e(A()),{rowData:J}=T(),{accessFormFef:R,accessForm:G,uNum:Y,dNum:$,unitForm:L,advancedConfiguration:Q,skipNull:W,AccessData:X}=O(),Z=(e,l,a)=>{""===l?a():""===l||void 0===l||null==l&&!W?a(new Error("请输入正确的IP地址")):q(l)?a():a(new Error("请输入正确的IP地址"))},ee=o({allowed_local_ips:[{required:!1,validator:Z,message:"请输入正确的IP地址",trigger:"blur"}],denied_local_ips:[{required:!1,validator:Z,message:"请输入正确的IP地址",trigger:"blur"}],allowed_client_ips:[{required:!1,validator:Z,message:"请输入正确的IP地址",trigger:"blur"}],denied_client_ips:[{required:!1,validator:Z,message:"请输入正确的IP地址",trigger:"blur"}]}),le=async()=>{const e=te();((e=G.value)=>{const l=["allowed_local_ips","denied_local_ips","allowed_client_ips","denied_client_ips"];for(const a of l)""!==e[a]&&(e[a]=e[a].replace(/\s+/g,""),W.value=!0,Z(0,e[a],e=>{if(e)throw C.error(e.message+"或将其置空"),new Error(e.message)}))})(),await R.value.validate();const{status:l}=await k({loading:"正在获取FTP权限数据,请稍后...",request:E(e),data:{status:Boolean},message:!0});return l},ae=()=>{Q.value=!Q.value},de=async()=>{const{name:e}=J.value;await k({loading:"正在获取FTP权限数据,请稍后...",request:H({username:e}),success:({data:e})=>{const{perForm:l,unitForms:a,uNums:d,dNums:s}=((e=X.value)=>{let l={},a={},d=0,s=0;for(const o in e){let t=e[o];if(["download_bandwidth","upload_bandwidth","max_size"].includes(o)){const e=t.slice(-2);a[o]=e||"MB",l[o]=t.slice(0,-2)}else if("time_restrictions"===o){if(""==t){l[o]=[new Date(2021,1,1,0,0),new Date(2021,1,1,23,59)];continue}const e=t.split("-"),a=e[0],d=e[1],s=a.slice(0,2),i=a.slice(2,4),n=d.slice(0,2),u=d.slice(2,4);l[o]=[new Date(2021,1,1,Number(s),Number(i)),new Date(2021,1,1,Number(n),Number(u))]}else if("ratio"===o){""==t&&(t="0:0");const e=t.split(":");d=Number(e[0]),s=Number(e[1])}else l[o]=t}return{perForm:l,unitForms:a,uNums:d,dNums:s}})(e);Y.value=d,$.value=s,Object.assign(G.value,l),Object.assign(L.value,a)}})},se=()=>{J.value={},G.value={}},oe=e=>[e.getHours().toString().padStart(2,"0"),e.getMinutes().toString().padStart(2,"0")],te=()=>{const e=L.value,l=G.value,a=Y.value,d=$.value,s=J.value.name;let o={download_bandwidth:"",upload_bandwidth:"",max_size:""};for(const i in e){let a=e[i],d=l[i];["download_bandwidth","upload_bandwidth","max_size"].includes(i)&&(""===d?o[i]="0":(""===a&&(a="KB"),o[i]=d+a))}let t="0000-0000";if(S(l.time_restrictions)&&l.time_restrictions.length>0){const e=new Date(l.time_restrictions[0]),a=new Date(l.time_restrictions[1]),[d,s]=oe(e),[o,i]=oe(a);t="".concat(d).concat(s,"-").concat(o).concat(i)}return l.ratio="".concat(a||"0",":").concat(d||"0"),"0:0"===l.ratio&&(l.ratio=""),{...l,time_restrictions:t,username:s,...o}},ie={class:"p-[20px]"},ne={class:"flex"},ue=M(t({__name:"index",setup(e,{expose:l}){const{accessFormFef:a,accessForm:d,uNum:s,dNum:o,icon:t,unitForm:k,advancedConfiguration:S,unitData:q}=O();return i(de),n(se),l({onConfirm:le}),(e,l)=>{const i=F,n=P,C=N,M=I,T=U,E=j,H=y,A=K,O=B,J=D,R=z;return u(),r("div",ie,[m(H,{model:_(d),ref_key:"accessFormFef",ref:a,class:"demo-form-inline",rules:_(ee),"label-width":"11rem"},{default:c(()=>[m(E,null,{default:c(()=>[m(T,{span:12},{default:c(()=>[m(M,{label:"下载带宽限制"},{default:c(()=>[m(C,{type:"number",min:0,placeholder:"请输入下载带宽限制",modelValue:_(d).download_bandwidth,"onUpdate:modelValue":l[1]||(l[1]=e=>_(d).download_bandwidth=e),class:"input-with-select"},{append:c(()=>[m(n,{modelValue:_(k).download_bandwidth,"onUpdate:modelValue":l[0]||(l[0]=e=>_(k).download_bandwidth=e),placeholder:"请选择"},{default:c(()=>[(u(!0),r(p,null,f(_(q),(e,l)=>(u(),w(i,{key:l,label:e,value:e},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),m(T,{span:12},{default:c(()=>[m(M,{label:"上传带宽限制"},{default:c(()=>[m(C,{type:"number",min:0,placeholder:"请输入上传带宽限制",modelValue:_(d).upload_bandwidth,"onUpdate:modelValue":l[3]||(l[3]=e=>_(d).upload_bandwidth=e),class:"input-with-select"},{append:c(()=>[m(n,{modelValue:_(k).upload_bandwidth,"onUpdate:modelValue":l[2]||(l[2]=e=>_(k).upload_bandwidth=e),placeholder:"请选择"},{default:c(()=>[(u(!0),r(p,null,f(_(q),(e,l)=>(u(),w(i,{key:l,label:e,value:e},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"]),m(H,{inline:!0,model:_(d),class:"demo-form-inline","label-width":"11rem"},{default:c(()=>[m(E,null,{default:c(()=>[m(T,{span:12},{default:c(()=>[m(M,{label:"最大文件数量限制"},{default:c(()=>[m(A,{type:"number",width:"18rem",min:0,modelValue:_(d).max_files,"onUpdate:modelValue":l[4]||(l[4]=e=>_(d).max_files=e),placeholder:"请输入最大文件数量限制"},null,8,["modelValue"])]),_:1})]),_:1}),m(T,{span:12},{default:c(()=>[m(M,{label:"最大文件大小限制"},{default:c(()=>[m(C,{style:{"min-width":"180px"},placeholder:"请输入内容",type:"number",min:0,modelValue:_(d).max_size,"onUpdate:modelValue":l[6]||(l[6]=e=>_(d).max_size=e),class:"input-with-select"},{append:c(()=>[m(n,{modelValue:_(k).max_size,"onUpdate:modelValue":l[5]||(l[5]=e=>_(k).max_size=e),placeholder:"请选择"},{default:c(()=>[m(i,{label:"MB",value:"MB"})]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),m(H,{inline:!0,model:_(d),class:"demo-form-inline","label-width":"11rem"},{default:c(()=>[m(E,null,{default:c(()=>[m(T,{span:12},{default:c(()=>[m(M,{label:"时间限制"},{default:c(()=>[m(O,{format:"HH:mm",style:{width:"18rem"},"is-range":"",modelValue:_(d).time_restrictions,"onUpdate:modelValue":l[7]||(l[7]=e=>_(d).time_restrictions=e),"range-separator":"-","start-placeholder":"开始","end-placeholder":"结束",placeholder:"选择时间范围"},null,8,["modelValue"])]),_:1})]),_:1}),m(T,{span:12},{default:c(()=>[m(M,{label:"最大并发会话数"},{default:c(()=>[m(A,{width:"18rem",type:"number",min:0,modelValue:_(d).max_sim_sessions,"onUpdate:modelValue":l[8]||(l[8]=e=>_(d).max_sim_sessions=e),placeholder:"请输入最大并发会话数"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),m(J,null,{default:c(()=>[b("span",{class:"bt-link",onClick:l[9]||(l[9]=(...e)=>_(ae)&&_(ae)(...e))},h("svgtofont-el-arrow-down"===_(t)?"展开":"收起")+"更多配置 ",1),b("i",{class:V(_(t))},null,2)]),_:1}),v(b("div",null,[m(H,{inline:!0,model:_(d),class:"demo-form-inline","label-width":"11rem"},{default:c(()=>[m(E,null,{default:c(()=>[m(T,{span:12},{default:c(()=>[m(M,{prop:"allowed_local_ips",label:"允许的本地IP地址"},{default:c(()=>[m(A,{width:"18rem",modelValue:_(d).allowed_local_ips,"onUpdate:modelValue":l[10]||(l[10]=e=>_(d).allowed_local_ips=e),placeholder:"请输入允许的本地IP地址"},null,8,["modelValue"])]),_:1})]),_:1}),m(T,{span:12},{default:c(()=>[m(M,{label:"拒绝的本地IP地址",prop:"denied_local_ips"},{default:c(()=>[m(A,{width:"18rem",modelValue:_(d).denied_local_ips,"onUpdate:modelValue":l[11]||(l[11]=e=>_(d).denied_local_ips=e),placeholder:"请输入拒绝的本地IP地址"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),m(H,{inline:!0,model:_(d),class:"demo-form-inline","label-width":"11rem"},{default:c(()=>[m(E,null,{default:c(()=>[m(T,{span:12},{default:c(()=>[m(M,{label:"允许的客户端IP地址",prop:"allowed_client_ips"},{default:c(()=>[m(A,{width:"18rem",modelValue:_(d).allowed_client_ips,"onUpdate:modelValue":l[12]||(l[12]=e=>_(d).allowed_client_ips=e),placeholder:"请输入允许的客户端IP地址"},null,8,["modelValue"])]),_:1})]),_:1}),m(T,{span:12},{default:c(()=>[m(M,{label:"拒绝的客户端IP地址",prop:"denied_client_ips"},{default:c(()=>[m(A,{width:"18rem",modelValue:_(d).denied_client_ips,"onUpdate:modelValue":l[13]||(l[13]=e=>_(d).denied_client_ips=e),placeholder:"请输入拒绝的客户端IP地址"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),m(H,{inline:!0,model:_(d),class:"demo-form-inline","label-width":"11rem"},{default:c(()=>[m(E,null,{default:c(()=>[m(T,{span:24},{default:c(()=>[m(M,{label:"上传和下载比率"},{default:c(()=>[b("div",ne,[m(R,{modelValue:_(s),"onUpdate:modelValue":l[14]||(l[14]=e=>x(s)?s.value=e:null),"controls-position":"right",min:0},null,8,["modelValue"]),l[16]||(l[16]=b("span",{class:"mx-12px"},":",-1)),m(R,{modelValue:_(o),"onUpdate:modelValue":l[15]||(l[15]=e=>x(o)?o.value=e:null),"controls-position":"right",min:0},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])],512),[[g,_(S)]]),l[17]||(l[17]=b("ul",{class:"mt-8px leading-8 text-[1.2rem] list-disc ml-20px"},[b("li",{class:"text-danger"},"注意:填写为0或为空时都表示不做限制,将按照上一次设定值延续。"),b("li",null,"允许的 IP 地址和被拒绝的 IP 地址若配置相同,将会拒绝该ip,因为“被拒绝”的设置优先级高于“被允许”的设置。"),b("li",null,"上传和下载比率限制:以上传文件数量和下载文件数量的形式表示。例如,设置为 “1:5”,那么用户每上传1个文件,就可以下载5个文件。设定其中某一个值为0将设置失败。"),b("li",null,"时间限制:指定用户可以访问FTP的时间范围。如:09:00到18:00,表示用户只能在这个时间范围内访问FTP。"),b("li",null,"最大并发会话数:即允许与FTP服务器同时建立的最大连接数。")],-1))])}}}),[["__scopeId","data-v-83d9d32b"]]);export{ue as default};
Save File
Cancel